package online.hxstart.code.concurrent.chapter03;

/**
 * @author huxing
 * @date 19-4-23 星期二 下午4:01
 * @describe
 */
public class ThreadPriority {

  public static void main(String[] args) {
    ThreadGroup group = new ThreadGroup("test");
    group.setMaxPriority(7);
    Thread t1 =
        new Thread(
            group,
            () -> {
              while (true) {
                System.out.println("t1");
                break;
              }
              Thread t3 = new Thread(() -> System.out.println("t1：child"));
              System.out.println("t3---->" + t3.getPriority());
              t3.start();
            });
    t1.setPriority(3);
    Thread t2 =
        new Thread(
            () -> {
              while (true) {
                System.out.println("t2");
                break;
              }
            });
    System.out.println(t1.getThreadGroup().getMaxPriority());
    System.out.println(t1.getPriority());
    t1.setPriority(10);
    System.out.println(t1.getPriority());
    t1.start();
    t2.start();

    System.out.println("t1 id：" + t1.getId());
    System.out.println("t1 id：" + t2.getId());
  }
}
